clear all
use "/Users/tatianapaula/Desktop/My paper project/Data analysis/logit regression/2018"
append using "/Users/tatianapaula/Desktop/My paper project/Data analysis/logit regression/2019"
append using "/Users/tatianapaula/Desktop/My paper project/Data analysis/logit regression/2020"

gen gender=1 if sexo==1

replace gender=0 if sexo==2

drop if religion>10
drop if rcor>5

tabulate religion, generate(relig)

tabulate income, generate(inc)

tabulate esc, generate(school)

logit DontTrust Dissatisfaction, or

logit DontTrust Dissatisfaction white gender age school7 school2 school3 inc2 inc3 inc4 relig3 relig5, or

logit DontTrust Dissatisfaction white gender age school7 school2 school3 inc2 inc3 inc4 relig3 relig5 Dissatisfaction##year, or

margins Dissatisfaction#year

tab2 DontTrust Dissatisfaction, row

//

collect clear
collect create MyModels

collect _r_b _r_p,                    ///
        name(MyModels)                 		    ///
        tag(model[(1)])                			///
        :logit DontTrust Dissatisfaction, or
		
collect _r_b _r_p,                    ///
        name(MyModels)                 		    ///
        tag(model[(2)])                			///
        :logit DontTrust Dissatisfaction white gender age school7 school2 school3 inc2 inc3 inc4 relig3 relig5, or
		
		
collect clear
collect create MyModels

collect _r_b _r_p,                    ///
        name(MyModels)                 		    ///
        tag(model[(1)])                			///
        :logit DontTrust Dissatisfaction white gender age school7 school2 school3 inc2 inc3 inc4 relig3 relig5 Dissatisfaction##year, or
		
		

collect layout (colname#result) (model), name(MyModels)
collect style cell cell_type[item column-header], halign(center)
collect style header result, level(hide)
collect style column, extraspace(1)
putpdf clear
putpdf begin
collect style putpdf, width(60%) indent(1 in)                                ///
        title("Table 1: Likelihood of lower level of trust in Armed Forces if the repsondent is insatisfied with Democracy in Brazil (A Cara da Democracia - 2018)") ///
        note("Standardized coefficients presented in OLS models; Odds ratios presented in Logits (p-values in parentheses)")
putpdf collect
putpdf save MyTable3.pdf, replace
